import Vue from 'vue'
import App from './App'
import router from './router'
import VueCookie from 'vue-cookie'
import httpRequest from '@/utils/httpRequest'
import api from '@/utils/api'
import store from '@/store'
import '../static/js/validate.js'
import 'babel-polyfill'
import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css'
import VueScroller from 'vue-scroller'

Vue.use(preview);
Vue.use(VueCookie);
Vue.use(VueScroller);
Vue.config.productionTip = false;

// 非生产环境, 适配mockjs模拟数据                 // api: https://github.com/nuysoft/Mock
if (process.env.NODE_ENV !== 'production') {
  //require('@/mock')
}

// 挂载全局
Vue.prototype.$http = httpRequest;// ajax请求方法
Vue.prototype.$api = api;//请求api接口

Vue.directive('tap',{
  bind:function(el,binding){
    el.addEventListener("tap",function (e) {
      var method = binding.value.method;
      var params = binding.value.params;
      method(params);
    },false);
  }
})

new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
